package task_system;

@SuppressWarnings("all")
public class Task {
	private int C; //worst case computation time
	private int D; //relative deadline
	private int P; //period : minimum time before next arrival
	
	public Task(int P, int D, int C){
		this.P = P;
		this.D = D;
		this.C = C;
	}
	
	public int C(){
		return C;
	}
	
	public int D(){
		return D;
	}
	
	public int P(){
		return P;
	}
	public int[] activation_triplet(){
		int result[] = {P,D,C};
		return result;
	}
	
	public boolean notCompatibleConfiguration(int p, int d, int c){
		return (((p - d) != (P - D) && d != 0)
				|| (d == 0 && p > (P - D)) 
				|| p > P || d > D || c > C 
				|| (c < C && p == P && d == D));
	}
	
	public boolean compatibleConfiguration(int p, int d, int c){
		return (
				((p - d) <= (P - D))
				&& p <= P && d <= D && c <= C 
				&&	((C - c) <= (P-p))
				);
	}
	
	public boolean compatibleTaskConfigurationSystem(int p, int d, int c){
		return (p<P && d<D);
	}
	
	public String toString(){
		String result = ""+ P + " " + D + " " + C;
		return result;
	}
}
